using System;
using System.Configuration;
using System.Runtime.Remoting;
using ODX.Core;
using ODX.Remoting.Shared;

namespace ODX.Remoting.Server
{
    public class Server : MarshalByRefObject, IServer
    {
        public Entity HandleEntity(Entity e, out Entity res)
        {
            res = e;
            return res;
        }

        public int HandleInt(int i)
        {
            return i;
        }
    }

    public class SampleXmlService : XmlDataService
    {
        protected override XmlDataProvider Provider
        {
            get
            {
                return new XmlDataProvider("remoting.xml");
            }
        }
    }

    class Program
    {
        static void Main()
        {
            Session serverSession = new Session();
            serverSession.RegisterAssembly(typeof(Human).Assembly);
            serverSession.Prepare();

            RemotingSessionManager.RegisterChannelSession(serverSession);
            
            RemotingConfiguration.Configure(
                ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath,
                false);

            Console.WriteLine("Press Enter to stop server...");
            Console.ReadLine();
        }
    }
}
